home *** CD-ROM | disk | FTP | other *** search
- EditNew.pas
-
- Comment in English y en Espa±ol.
-
- English
- -------------------------------------------------------------------------------
- - Author : Jose Maria Gias Zaragoza - Spain
- - email : sigecom@arrakis.es
- - Version : 2.1
- - Date : 26.05.98
- - Type : FreeWare
-
- - Package of 3 Components TEdit, TMaskEdit and TDBEDIT, that try to integrate
- many of the actions that customarily are accomplished in the applications
- upon using the components standard TEdit, and adds the following properties:
-
- Properties:
-
- ColorOnFocus - Back Color when the Edit has the focus
-
- ColorOnNotFocus - Back Color when the Edit Does not has the focus
-
- FontColorOnFocus - Back font color when the Edit has the focus
-
- FontColorOnNotFocus - Back font Color when the Edit Does not has the focus
-
- KeyByTab - Response upon pulsateing a key as if is pulsateed Tabulator
- to leave of the component happening the focus to the
- following, with the value of other key.
-
- For defect is assigned the standar of Windows Tabulator for
- to annul it: KeyByTab = #9
-
- For example, if we wish that of a TEditN could be happened
- the focus to the following object with the Return key, in
- addition to with the Tabulator, we would put this value to
- KeyByTab = #13
-
- WidthOnFocus - Permits to define a width of the different EditN when the
- EditN has the Focus. The width is not adjusted in function
- of the introduced text, being had to be defined in design
- mode.
-
- - The TEditN and TDBEditN includes furthermore the following properties:
-
- FirstCharUpper - Converts to Uppers the first char of the string if
- EditType = etString
-
- FirstCharupList - Converts to capital letters any character located behind
- the characters written in this property, as long as
- FirstCharUpper it will be True
-
- - The TEditN includes furthermore the following properties and methods:
-
- EditType - etString, etInteger, etFloat, etDate, etTime. Consideration
- of the data that it will contain the Edit
-
- etDate. Permit to introduce manually part of the date and
- the Edit end of completing it
-
- etTime. Permit to introduce part of a time and the Edit
- end of completing it
-
- EditAlign - etAlignRight, etAlignLeft, etAlignCenter, etAlignNone.
-
- Align the string, with respect to the indicated length
- in EditLengthAlign, when EditType = etString
-
- etAlignValue. If EditType = etInteger or etFLoat, fills with 0
- the spaces to the left of the String until completing the
- quantity of characters indicated in EditLengthAlign.
- Observe the negative sign if it has been introduced, and
- the separating decimal counting as a char more of the string.
-
- EditLengthAlign - Length of the string when it is aligned. Have into account
- when EditAlign <> etAlignNone, and is fulfilled indicated
- what is for EditAlign
-
- ValueInteger - Integer Value of the Edit, when EditType = etInteger
- If is produced a conversion mistake would return 0
-
- ValueFloat - FloatValue of the Edit, when EditType = etFloat
- If is produced a conversion mistake would return 0
-
- ValueDate - Value TDateTime when the Edit is etDate. In this case, in
- ValueInteger and ValueFloat, it is returned the value Integer
- or Double of the date
-
- ValueTime - Value TDateTime when the Edit is etTime. In ValueFloat
- returns the value Double of Time
-
- EditPrecision - Permits to define the quantity of decimal. If the value is
- greater than 0, format the value, completing with zeroes to
- the end if there is no decimal introduced.
-
- ## In the case of be value Float, the separating decimal it
- catch by defect of Windows.
-
- TimeSeconds - Is added the property TimeSeconds, to indicate that when
- the Edit is etTime, it fills the seconds. All the varying
- of time are completed with 00
-
- Methods:
-
- SetInteger - Procedure, by the one which can allot directly a value
- Integer to the EditN, when it is defined as etInteger
- Example: EditN10.SetInteger(63565);
-
- SetFloat - Procedure, by the one which can allot directly a value
- Float to the EditN, when it is defined as etFloat.
- Example: EditN9.SetFloat(- 63,56);
-
- SetPtrToData - Assigns the EditN to a variable, so that when change the
- value of the Edit, will change automatically that of the
- variable, and to the contrary, by middle of the procedure
- Update
-
- Update - Updates the value of the EditN with that of the assigned
- variable. To see the demo for demonstration of as can be
- created in RunTime arrays of EditN and to assign them in
- a way dynamic to Arrays of values Integer, Float or String
- in function of the value of an index, what permits be
- displaced on a array with an alone block of EditN.
-
- ###############################################################################
-
- Version 1.01
-
- - Include controls to avoid that is generated exception upon converting a
- value integer, when it exceeds of the maximum ranges of said type.
-
- In this case, it notifies of the fact that it has been exceeded of the
- range, and lets ValueInteger = 0
-
- - Include control so that when it is a value Float could not be introduced
- but of 20 digits
-
- ###############################################################################
-
- Version 1.02
-
- - Amends an existing Bug when the EditType = etString or etFloat, and is loaded
- directly a value on the EditNew, so that ValueInteger and ValueFloat they
- are not updated. Part of the procedure DoExit has been separated to Change.
-
- - Is added a control to eliminate the characters not permitted, before
- to convert to Integer or Float.
-
- - Change control so that when it is a value Float could not be introduced
- but of 16 digits. Now ValueFloat is Double, before is Extended.
-
- - Is added the property WidthOnFocus for power to configure a Width of the Edit
- when this has the Focus. It is valid when its value is greater than 0
-
- -------------------------------------------------------------------------------
- ## The following properti are introduced by Raymond Kleefstra:
-
- - Raymond Kleefstra
- - mail: rkleefstra@tip.nl
- - URL: http://stad.dsl.nl/~malloc
-
- TextAtEnter - Memories the exact text as it was when the field is entered.
- Is used to cancel changed when ESC is pressed
-
- ###############################################################################
-
- Version 1.03 07.12.1997
-
- - Is amended an Bug of the prior version, by the one which the property MaxLength
- it is put automatically with value 10.
-
- - Is amended a Bug that was happening in manner designer, when defining
- etInteger or etFloat and to enter to erase the value of Text, gave a Range
- error
-
- - Is included in the refunding of FirstCharUpper in the proceeding OnExit, for
- the case of the fact that is traded to the first position during the edition.
-
- - Is traded the decision of the events OnKeyPress, OnEnter, OnExit, OnChange
- to the public part for power to use them thereinafter
-
- - Is included the option of introducing directly a value Integer or Float
- according to this the property EditType, with the proceeding SetInteger or
- SetFloat respectively. To see the demo for its operation
-
- ###############################################################################
-
- Version 2.0 17.05.1998
-
- 28/04/98 Addition by Andrea Sessa asessa@nest.it
-
- FontColorOnFocus - Back font color when the Edit has the focus
-
- FontColorOnNotFocus - Back font Color when the Edit Does not has the focus
-
- 14/05/98 Addition by idea of Marcio William liftbr@ibm.net
-
- - Are updated always ValueInteger and Appraise Float when the Edit is
- <> of etString
-
- - Are assembled in the file EditNew.Pas the components:
- - EditNew - TEditN
- - MaskEditNew - TMEDITN
- - DBEDITNEW - TDbEditN
-
- 15/05/98 Addition by Raymond Kleefstra rkleefstra@tip.nl
-
- - Connection procedures of the value of the Edit in function of its type
- etInteger, etFloat, etString, etDate, etTime to a variable or position
- of a array of the same type.
-
- - SetPtrToData - Assigns the Edit to a variable, so that when change the
- value of the Edit, will change automatically that of the
- variable, and to the contrary by middle of the procedure
- Update
-
- - Update - Updates the value of the Edit with that of the assigned variable
-
- 16/05/1998 Addition by the author
-
- - In the demo is shown as creating arrays of TEditN in runtime in a
- form, and to assign it directly to a array of integer, according to
- the connection that establishes the index iIndex, as well as the form of
- it be displaced with the array of TEdit on the array of integer.
-
- In function of the type of the TEditN, it should be connected to a array
- of the same type, for example, if the TEditN is etFloat, the array will
- be float (Double) and will be tried without no type to conversion.
- To see the example for the case of Integer.
-
- If type is etString, in principle must be ShortString variable
-
- ###############################################################################
-
- Version 2.1 26.05.1998
-
- 24/05/1998 Addition by the author
-
- - Is modified the code as a rule, and are let commentaries only
- in English, optimizing it in part to make but understandable the
- same. They are implemented the mentioned ideas below,
- varying the code with respect to suggest by the authors.
-
- 25/05/1998 For idea of JosΘ M¬ Torrecilla Zaragoza - Spain
-
- - Are added the types etDate and etTime, guided to the users that
- prefer to introduce manually the date or the hour, and the
- component is entrusted with completing it. For example:
-
- If for a date is not indicated nothing, by defect catchs the current.
-
- If is indicated 4, understands that it is gave it 04 of the month
- and current year.
-
- If is indicated 0510, is completed to 05/10/1998. If is indicated 230695
- will understand that it is 23/06/1995, since catchs the current century by
- defect.
-
- If is wanted to indicate a date of the century 21, being in the century
- 20, it is necessary to indicate the complete date (When we are in the
- century 21 no longer it will be necessary) 17012000 : 17/01/2000
-
- In any case, serves to indicate the date without separating, already
- that the Edit will put by defect specified it in the configuration
- regional of Windows, or to indicate the hour with the separating
- specified in such configuration.
-
- In the case of be etDate, returns in the event OnExit the value
- Integer and Double of the date indicated in ValueInteger and ValueFloat,
- and if it has been defined the pointer to other variable, will be updated
- also. If it is etTime, in ValueFloat returns the value Double of
- Time.
-
- - Is added the property TimeSeconds, to indicate if when the Edit
- it is etTime, it will fill or not the seconds. All the variants of
- time are completed with 00
-
- 26/05/1998 - By idea of Oscar Felis oscar@callcentereurope.dk
-
- - Is added the property FirstCharUpList that causes that convert to
- capital letters any letter that is written after of any character
- indicated in the property, always that FirstChartUpper it will be
- True. For defect is ' (' .Por example:
-
- If we departed of the characters by defect, will be converted to
- capital letters any letter introduced after a character of
- space or of bracket.
-
- ###############################################################################
- To be Freeware, they are not offered guarantees of no class neither are admitted
- claims of no type.
-
- This component can be used, be distributed and be modified freely for use
- particular or didactic, but not for commercial use. For commercial use be put
- in touch with the author.
-
- This component can be put on the page WEB that is wished, be redistributed
- with an application freely, or be included in any book, CDROM or any other
- middle, as long as is included 100% of the content of the component.
-
- It will be thanked the one which any commentary, alteration or improvement
- introduced in the component is transmitted to the author.
-
- -------------------------------------------------------------------------------
- Espa±ol
- -------------------------------------------------------------------------------
- - Autor : Jose Maria Gias Zaragoza - Espa±a
- - email : sigecom@arrakis.es
- - Versi≤n : 2.1
- - Fecha : 26.05.98
- - Tipo : FreeWare
-
- - Paquete de 3 Componentes TEditN, TMEditN (TMaskEdit) y TDBEditN ampliados, que
- tratan de integrar muchas de las acciones que habitualmente se realizan en las
- aplicaciones al utilizar los componentes TEdit estßndar, y a±ade las siguientes
- propiedades:
-
- ColorOnFocus - Color de fondo cuando el Edit tiene el Foco
-
- ColorOnNotFocus - Color de fondo cuando el Edit No tiene el Foco
-
- FontColorOnFocus - Cambia el color de la fuente cuando el Edit
- tiene el foco
-
- FontColorOnNotFocus - Cambia el color de la fuente cuando el edit
- pierde el foco
-
- KeyByTab - Respuesta al pulsar una tecla, como si se pulsara Tabulador
- para salir del componente, pasando el foco al siguiente, con
- el valor de otra tecla.
-
- Por defecto se asigna el estandar de Windows: Tabulador, para
- anularlo: KeyByTab = #9
-
- Por ejemplo, si deseamos que de un TEditN se pueda pasar el
- foco al siguiente objeto con la tecla Enter ademas de con
- el Tabulador, pondriamos esta valor a KeyByTab = #13
-
- WidthOnFocus - Permite definir una anchura del TEditN diferente cuando el
- EditN tiene el Foco. La anchura no se ajusta en funci≤n del
- texto introducido, debiendose definirse en modo dise±o.
-
- - El TEditN y TDBEditN incluyen tambiΘn las siguientes propiedades:
-
- FirstCharUpper - Convierte a mayusculas el primer Caracter de la cadena si
- EditType = etString, en el evento OnExit
-
- FirstCharupList - Convierte a may·sculas cualquier caracter situado detras de
- los caracteres escritos en esta propiedad, siempre que
- FirstCharUpper sea True. Por defecto : ' ('
-
- - El TEditN incluye ademas las siguientes propiedades y mΘtodos:
-
- EditType - etString, etInteger, etFloat, etDate, etTime. Consideraci≤n
- de los datos que contendrß el Edit
-
- etDate. Permite introducir manualmente parte de la fecha y
- el Edit termina de completarla.
-
- etTime. Permite introducir parte de un tiempo y el Edit
- termina de completarlo.
-
- EditAlign - etAlignRight, etAlignLeft, etAlignCenter, etAlignNone.
- Alinean la cadena, con respecto a la longitud indicada en
- EditLengthAlign, cuando EditType = etString
-
- etAlignValue. Si EditType = (Integer or FLoat), rellena con
- 0 los espacios a la Izqda. de la cadena, hasta completar la
- cantidad de caracteres indicada en EditLengthAlign.
-
- Respeta el signo negativo si se ha introducido, y el separador
- decimal contando como un caracter mas de la cadena.
-
- EditLengthAlign - Longitud de la cadena cuando es alineada. Se tiene en cuenta
- cuando EditAlign <> etAlignNone, y se cumple lo indicado para
- EditAlign
-
- ValueInteger - Valor Integer del Edit, cuando EditType <> (etString or etTime)
- Si se produjera un error de conversi≤n devolverφa 0
-
- ValueFloat - Valor Double del Edit, cuando EditType <> etString
- Si se produjera un error de conversi≤n devolverφa 0
-
- ValueDate - Valor TDateTime cuando el Edit es etDate. En este caso, en
- ValueInteger y ValueFloat, se devuelve el valor Integer o
- Double de la fecha
-
- ValueTime - Valor TDateTime cuando el Edit es etTime. En Value Float
- devuelve el valor Double de Time
-
- EditPrecision - Permite definir la cantidad de decimales. Si el valor es
- mayor de 0, formatearß el valor, completando con ceros al
- final si no hay decimales introducidos.
-
- ## En el caso de ser valor Float, el separador decimal lo
- coge por defecto de Windows.
-
- TimeSeconds - Se a±ade la propiedad TimeSeconds, para indicar que cuando
- el Edit es etTime, rellena los segundos. Todas las
- variantes de tiempo se completan con 00
-
- Procedures:
-
- SetInteger - Podemos asignar directamente un valor Integer al TEditN,
- cuando estß definido como etInteger Ejemplo:
-
- EditN10.SetInteger(63565);
-
- SetFloat - Podemos asignar directamente un valor Float al TEditN,
- cuando estß definido como etFloat. Ejemplo:
-
- EditN9.SetFloat(-63,56);
-
- SetPtrToData - Asigna el Edit a una variable, de forma que cuando
- cambie el valor del Edit, cambiarß automßticamente
- el de la variable, y al contrario, por medio del
- procedimiento Update
-
- Update - Actualiza el valor del Edit con el de la variable asignada
-
- # Ver la demo para demostraci≤n de como se pueden crear en
- RunTime arrays de EditN y asignarlas de forma dinßmica a
- Arrays de valores Integer, Float ≤ String en funci≤n del
- valor de un indice, lo que permite desplazarse sobre un
- array con un solo bloque de EditN.
-
- ###############################################################################
- Version 1.01 05.06.1997
-
- - Incluye controles para evitar que se genere excepcion al convertir un valor
- Integer, cuando excede de los rangos mßximos de dicho tipo.
-
- En este caso, avisa de que se ha excedido del rango, y deja ValueInteger = 0
-
- - Incluye control para que cuando es un valor Float no puedan introducirse
- mas de 20 dφgitos
-
- ###############################################################################
- Version 1.02 25.07.1997
-
- - Corrige un Bug existente cuando el EditType = etString o etFloat, y se carga
- directamente un valor sobre el EditNew, de forma que ValueInteger y
- ValueFloat no se actualizan. Parte del procedimiento DoExit se ha separado
- a Change.
-
- - Se a±ade un control para eliminar los caracteres no permitidos, antes de
- convertir a Integer o Float.
-
- - Value Float se cambia de tipo Extended a Double por ser el genΘricamente
- mas utilizado.
-
- - Se a±ade la propiedad WidthOnFocus para disponer de un ancho del Edit
- configurable cuando este tiene el Foco. Se tiene en cuenta cuando su valor
- es mayor de 0
-
- -------------------------------------------------------------------------------
- Cambios por Raymond Kleefstra
-
- - Raymond Kleefstra
- - mail: rkleefstra@tip.nl
- - URL: http://stad.dsl.nl/~malloc
-
- - Al pulsar la tecla Escape, anula los cambios, en lugar de borrar el contenido
-
- ###############################################################################
- Version 1.03 07.12.1997
-
- - Se corrige un Bug de la versi≤n anterior, por el cual la propiedad MaxLength
- se ponia automßticamente con valor 10.
-
- - Se corrige un Bug que ocurrφa en modo dise±o, al definir etInteger o etFloat,
- y entrar a borrar el valor de Text, daba un error de Rango
-
- - Se incluye en la conversi≤n de FirstCharUpper en el procedimiento OnExit,
- para el caso de que se cambie a la primera posici≤n durante la edici≤n.
-
- - Se cambia la definici≤n de los eventos OnKeyPress, On Enter, OnExit, OnChange
- a la parte p·blica para poder utilizarlos posteriormente
-
- - Se incluye la opci≤n de introducir directamente un valor Integer o Float seg·n
- este la propiedad EditType, con el procedimiento SetInteger o SetFloat
- respectivamente. Ver la demo para su funcionamiento
-
- ###############################################################################
-
- Version 2.0 17.05.1998
-
- 28/04/98 A±adido por Andrea Sessa asessa@nest.it
-
- FontColorOnFocus - Cambia el color de la fuente cuando el Edit
- tiene el foco
-
- FontColorOnNotFocus - Cambia el color de la fuente cuando el edit
- pierde el foco
-
- 14/05/98 A±adido por idea de Marcio William liftbr@ibm.net
-
- - Se actualizan siempre ValueInteger y Value Float cuando el Edit es
- <> de etString
-
- - Se juntan en el fichero EditNew.Pas los componentes:
- - EditNew - TEditN
- - MaskEditNew - TMEditN
- - DBEditNew - TDbEditN
-
- 15/05/98 A±adido por Raymond Kleefstra rkleefstra@tip.nl
-
- - Procedimientos de conexi≤n del valor del Edit en funci≤n de su tipo
- etInteger, etFloat, etString a una variable o posici≤n de un array
- del mismo tipo.
-
- - SetPtrToData - Asigna el Edit a una variable, de forma que cuando
- cambie el valor del Edit, cambiarß automßticamente
- el de la variable, y al contrario por medio del
- procedimiento Update
-
- - Update - Actualiza el valor del Edit con el de la variable asignada
-
- 16/05/1998 A±adido por el autor
-
- - En la demo se muestra como crear arrays de TEditN en runtime en un
- formulario, y asignarlo directamente a un array de integer, seg·n
- la conexi≤n que establece el φndice iIndex, asφ como la forma de
- desplazarse con la array de TEdit sobre el array de integer.
-
- En funci≤n del tipo del TEditN, se deberß conectar a un array del
- mismo tipo, por ejemplo, si el TEditN es etFloat, el array serß
- float (Double) y se tratarß sin ning·n tipo de conversi≤n.
- Ver el ejemplo para el caso de Integer.
-
- Si es etString, en principio tiene que ser ShortString
-
- ###############################################################################
-
- Version 2.1 26.05.1998
-
- 24/05/1998 A±adido por el autor
-
- - Se modifica el c≤digo en general, y se dejan comentarios solamente
- en Ingles, optimizßndolo en parte para hacer mas entendible el
- mismo. Se implementan las ideas mencionadas a continuaci≤n,
- variando el c≤digo con respecto al sugerido por los autores.
-
- 25/05/1998 Por idea de JosΘ M¬ Torrecilla - Zaragoza - Espa±a
-
- - Se a±aden los tipos etDate y etTime, orientados a los usuarios que
- prefieren introducir manualmente la fecha o la hora, y el
- componente se encarga de completarla. Por ejemplo:
-
- Si para una fecha no se indica nada, por defecto coge la actual.
-
- Si se indica 4, entiende que es el dia 04 del mes y a±o actual.
-
- Si se indica 0510, se completa a 05/10/1998. Si se indica 230695
- entenderß que es el 23/06/1995, ya que coge el siglo actual por
- defecto.
-
- Si se quiere indicar una fecha del siglo 21, estando en el siglo
- 20, es necesario indicar la fecha completa (Cuando estemos en el
- siglo 21 ya no serß necesario) 17012000 : 17/01/2000.
-
- En cualquier caso, sirve para indicar la fecha sin separador, ya
- que el Edit pondrß por defecto la especificada en la configuraci≤n
- regional de Windows, o para indicar la hora con el separador
- especificado en dicha configuraci≤n.
-
- En el caso de ser etDate, devuelve en el evento OnExit el valor
- Integer y Double de la fecha indicada en ValueInteger y ValueFloat,
- y si se ha definido el puntero a otra varible, se actualizarß
- tambiΘn. Si es etTime, en ValueFloat devuelve el valor Double de
- Time.
-
- - Se a±ade la propiedad TimeSeconds, para indicar si cuando el Edit
- es etTime, rellenarß o n≤ los segundos. Todas las variantes de
- tiempo se completan con 00
-
- 26/05/1998 - Por idea de Oscar Felis oscar@callcentereurope.dk
-
- - Se a±ade la propiedad FirstCharUpList que hace que convierta a
- may·sculas cualquier letra que se escriba despues de cualquier
- caracter indicado en la propiedad, siempre que FirstChartUpper
- sea True. Por defecto es ' (' .Por ejemplo:
-
- Si partimos de los caractΘres por defecto, se convertirß a
- may·sculas cualquier letra introducida despues de un caracter de
- espacio o de parΘntesis.
-
- ###############################################################################
- Al ser Freeware, no se ofrecen garantφas de ninguna clase, ni se admiten
- reclamaciones de ningun tipo.
-
- Este componente puede usarse, distribuirse y modificarse libremente para uso
- particular o didßctico, pero no para uso comercial. Para uso comercial ponerse
- en contacto con el autor.
-
- Este componente puede ponerse en la pßgina WEB que se desee, redistribuirse con
- una aplicaci≤n libremente, o incluirse en cualquier libro, CDROM o cualquier
- otro medio, siempre que se incluya el 100% del contenido del componente.
-
- Se agradecerß el que cualquier comentario, correcci≤n o mejora introducida en
- el componente se remita al autor.
-
-